﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="fastFact_admin.aspx.cs" Inherits="NCC_SOP.Admin.fastFact_admin" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>



<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

  <div style="float:left;width:100%;">
      <telerik:RadGrid ID="staticReportList" runat="server" Width="100%" DataSourceID="SqlDataSource1"
          AllowFilteringByColumn="True" AllowSorting="True" AllowPaging="True" PageSize="7"
          AutoGenerateColumns="False" OnPreRender="RadGrid1_PreRender" ShowStatusBar="true"
          EnableLinqExpressions="false">

          <MasterTableView DataKeyNames="rptID">
              <Columns>
                  <telerik:GridBoundColumn UniqueName="rptName" DataField="rptName" HeaderText="Report Name"
                      AllowFiltering="false" HeaderStyle-Width="200px" />

                  <telerik:GridBoundColumn UniqueName="cancerSite" DataField="cancerSite" HeaderText="Cancer Site"
                      HeaderStyle-Width="200px">
                      <FilterTemplate>
                          <telerik:RadComboBox ID="RadComboBoxDS" DataSourceID="SqlDataSource2" DataTextField="cancerSite"
                              DataValueField="cancerSite" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("cancerSite").CurrentFilterValue %>'
                              runat="server" OnClientSelectedIndexChanged="DSIndexChanged">
                              <Items>
                                  <telerik:RadComboBoxItem Text="All" />
                              </Items>
                          </telerik:RadComboBox>
                          <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                              <script type="text/javascript">
                                  function DSIndexChanged(sender, args) {
                                      var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                      tableView.filter("cancerSite", args.get_item().get_value(), "EqualTo");
                                  }
                              </script>
                          </telerik:RadScriptBlock>
                      </FilterTemplate>
                  </telerik:GridBoundColumn>


                  <telerik:GridBoundColumn UniqueName="statsType" DataField="statsType" HeaderText="Statistic Type"
                      HeaderStyle-Width="200px">
                      <FilterTemplate>
                          <telerik:RadComboBox ID="RadComboBoxType" DataSourceID="SqlDataSource3" DataTextField="statsType"
                              DataValueField="statsType" Height="200px" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("statsType").CurrentFilterValue %>'
                              runat="server" OnClientSelectedIndexChanged="TypeIndexChanged">
                              <Items>
                                  <telerik:RadComboBoxItem Text="All" />
                              </Items>
                          </telerik:RadComboBox>
                          <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                              <script type="text/javascript">
                                  function TypeIndexChanged(sender, args) {
                                      var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                      tableView.filter("statsType", args.get_item().get_value(), "EqualTo");
                                  } 
                              </script>
                          </telerik:RadScriptBlock>
                      </FilterTemplate>
                  </telerik:GridBoundColumn>



                  <telerik:GridBoundColumn UniqueName="rptDescription" DataField="rptDescription" HeaderText="Report Description"
                      AllowFiltering="false" HeaderStyle-Width="200px" />

                  
                  <telerik:GridTemplateColumn 
                    UniqueName="edit" 
                    AllowFiltering="false" 
                    HeaderText="EDIT">
                     <ItemTemplate>
                         <a href='rpt_editPage.aspx?rptID=<%#Eval("rptID").ToString().Trim() %>'>
                         <%#Eval("isRPT").ToString().Equals("0") ?
                                                         "<img src='../images/file_view.jpg' width='20px' height='20px' alt='' />":
                                                         "<img src='../images/file_view.jpg' width='20px' height='20px' alt='' /><img src='../images/Dynamic_Icon.png' width='20px' height='20px' alt='' />"
                         %>
                         </a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>


              </Columns>
          </MasterTableView>
      </telerik:RadGrid>
  </div>
  
  <div style="float:left;width:100%;padding-top:10px;">
    <a href="fastFact_Add.aspx">Add New Report</a>
  </div>
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:localSQLString %>"
            ProviderName="System.Data.SqlClient" 
            SelectCommand="select DISTINCT tableID as rptID, tableName as rptName,fileName, tableDescription AS rptDescription, cancerSite, statsType, isRPT from metaDisplay_fastFact"
            ></asp:SqlDataSource>


  <asp:SqlDataSource ID="SqlDataSource2"  runat="server" ConnectionString="<%$ ConnectionStrings:localSQLString %>"
            ProviderName="System.Data.SqlClient" 
            SelectCommand="select distinct cancerSite from metaDisplay_fastFact"

            ></asp:SqlDataSource>

  <asp:SqlDataSource ID="SqlDataSource3"  runat="server" ConnectionString="<%$ ConnectionStrings:localSQLString %>"
            ProviderName="System.Data.SqlClient" 
            SelectCommand="select distinct statsType from metaDisplay_fastFact "
            ></asp:SqlDataSource>



</asp:Content>

